using Holoville.HOTween;
using UnityEngine;

public class OverheadTextMessage : MonoBehaviour
{
	public float liveTime = 1f;

	public UILabel textLabel;

	private UIWidget messageWiget;

	private void Start()
	{
		messageWiget = GetComponent<UIWidget>();
		if ((bool)messageWiget)
		{
			messageWiget.alpha = 0f;
			HOTween.Init();
			HOTween.Kill(messageWiget);
			HOTween.To(messageWiget, 0.25f, new TweenParms().Prop("alpha", 1));
		}
		Invoke("Remove", liveTime);
	}

	private void Remove()
	{
		if ((bool)messageWiget)
		{
			HOTween.To(messageWiget, 0.25f, new TweenParms().Prop("alpha", 0));
		}
		Invoke("DestroyThis", 0.25f);
	}

	private void DestroyThis()
	{
		Object.Destroy(base.gameObject);
	}
}
